<?php 
       	require_once('include/JobSeeker.class.php'); 
        require_once('include/OurDatabase.class.php');
        include("include/session.php");
        
        $JS = new JobSeeker();
        
        $DB = new OurDatabase();
        
		$DB->open_connection();  
        
        if($session->logged_in){        
?>

<!DOCTYPE html>
<html>
<head>
        <title>Job Search</title>

        <style type="text/css">
                .auto-style1 {
                        color: #000000;
                        font-family: "Lao UI";
                        font-size: medium;
                }
                .auto-style2 {
                        color: #000000;
                        font-family:"Lao UI";
                        font-size: medium;
                }
                .auto-style3 {
                        color: red;
                        font-family:"Lao UI";
                        font-size:x-large;
                        text-align: center;
                        font-weight:bold;
                        text-decoration: none;
                }
                .auto-style4 {
                        color:black;
                        font-family:"Lao UI";
                        font-size:x-large;
                        text-align: center;
                        font-weight:bold;
                        text-decoration: none;
                }
                .auto-style5 {
                        font-family: "Lao UI";
                        padding-top: 10px;
                        padding-bottom: 15px;
                        margin-left: auto;
                        margin-right: auto;


                }
        </style>
</head>

<body>
			<?php include('header.php');?>
        
                <div class="auto-style10"> 
                
                <br><br>
                
                        <table align="center">
                                <tr>
                                        <td width="250">
                                        <form action="jobresultspage.php" method="post">
                                                <select name="Type">
                                                        <!-- The $_POST value will be $_POST['JobType'] for the filter handling below. -->
                                                        <option value="0">Job Industry</option>
                                                        <?php
                                                                echo $JS->get_dropdown_options("wms_types","type_name");
                                                        ?>
                                                </select><br />
                                                <select name="Duration">
                                                        <option value="0">Job Duration</option>
                                                        <option value="Perm">Permanent</option>
                                                        <option value="Temp">Temporary</option>
                                                </select><br />
                                                <select name="City">
                                                        <!-- The $_POST value will be $_POST['JobType'] for the filter handling below. -->
                                                        <option value="0">Job City</option>
                                                        <?php
                                                                echo  $JS->get_unique_dropdown_options("wms_job","job_city");
                                                        ?>
                                                </select><br />
                                                <select name="State">
                                                        <!-- The $_POST value will be $_POST['JobType'] for the filter handling below. -->
                                                        <option value="0">Job State</option>
                                                        <?php
                                                                echo $JS->get_unique_dropdown_options("wms_job","job_state");
                                                                
                                                                $DB->close_connection();
                                                        ?>
                                                </select><br />
                                                <button name="Abutton1">Show Filtered Jobs</button>
                                        </form>
                                        </td>
                                        <td width="250">
                                        <form action="jobresultspage.php" method="post">
                                                <input type="hidden" name="Duration" value="0" />
                                                <input type="hidden" name="City" value="0" />
                                                <input type="hidden" name="State" value="0" />
                                                <input type="hidden" name="Type" value="0" />
                                                <button name="Abutton2">Display all Jobs</button>
                                        </form>
                                        </td>
                                </tr>
                        </table>
                        
                </div>
        </form>
        
<?php }
else{
?>

<h1>Login</h1>
<?
/**
 * User not logged in, display the login form.
 * If user has already tried to login, but errors were
 * found, display the total number of errors.
 * If errors occurred, they will be displayed.
 */
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="lul/seeker/index.php">Sign-Up!</a></td></tr>
</table>
</form>

<?
}

/**
 * Just a little page footer, tells how many registered members
 * there are, how many users currently logged in and viewing site,
 * and how many guests viewing site. Active users are displayed,
 * with link to their user information.
 */
echo "</td></tr><tr><td align=\"center\"><br><br>";
echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br>";

include("include/view_active.php");

?>


</body>

</html>
